package com.service.atf.base.core;



import com.service.atf.base.model.BaseHeader;
import com.service.atf.base.type.ResultReplyRead;

import java.util.HashMap;
import java.util.Map;

/**
 * User: luotao
 * Date: 12-3-23
 * Time: 16:06:00
 */
public abstract class TFRollAbstractController implements IReadProcess {
    protected Map<String, ITFReadBussProcess> processMap = new HashMap<String, ITFReadBussProcess>();

    @Override
    public ResultReplyRead doRead(ITFInfo itfInfo, int offset, byte[] data) {
        String type = BaseHeader.getTypeAndTradeType(data);
        if ("23".equals(type)) {
            return new ResultReplyRead(GlobalDefine.TF_STATUS_END);
        }
        ITFReadBussProcess readBussProcess = processMap.get(type);
        if (readBussProcess == null) {
            return new ResultReplyRead(GlobalDefine.TF_STATUS_END);
        }
        ResultReplyRead replyRead = readBussProcess.doProc(type, offset, data);
        return replyRead;
    }

  //  public abstract void loadService(XmlWapper wapper);
}
